package com.anzia.demo01;

/**
 *@ClassName Outer
 *@Description
 *@Author Anzia.
 *@Date 2021/4/10 19:29
 *@Version 1.0
 **/
public class Outer {
    //实例变量
    private String name = "张三";
    private int age = 20;

    //内部类
    class Inner {
        private String address = "北京";
        private String phone = "110";

        //测试内部类同名属性
        private String name = "李四";

        //方法
        public void show() {
            //打印内部类的属性
            System.out.println(name);
            //属性和外部类的属性名字相同，Outer.this
            System.out.println(Outer.this.name);
            System.out.println(age);

            //打印外部类的属性
            System.out.println(address);
            System.out.println(phone);
        }
    }
}
